package com.mk.juc;


import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * 有返回参数的线程
 */
public class CallAbleDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask task = new FutureTask(new MyCallAble());
        new Thread(task, "A").start();
        System.out.println(task.get());
    }
}

class MyCallAble implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        return 1024;
    }
}
